package ps.net;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;





public class MessageContent implements PacketContent {
    
    String msg = "";
    
    MessageContent() {
        this("");
    }
    
    public MessageContent(String msg) {
        this.msg = msg;
    }
    
    @Override
    public void writeContent(OutputStream out) throws IOException {
        Packet.writeString(out, msg);
    }
    
    @Override
    public void readContent(InputStream in) throws IOException {
        msg = Packet.readString(in);
    }
    
    @Override
    public String toString() {
        String ret = "[ Message |";
        ret += " msg=\"" + msg + "\"";
        ret += " ]";
        return ret;
    }
    
    public String getMsg() {
        return msg;
    }
    
    public void setMsg(String msg) {
        this.msg = msg;
    }
    
}
